
package com.pack1;

import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;

@Aspect
public class Audience {
	
	//Defines performance 	pointcut
	//@Pointcut("execution(* *.perform(..))")
	@Pointcut("execution(* *(..))")
	//@Pointcut("execution(com.pack2 public void perform())")
	public void performance() {}
	
	@Before("performance()")
	public void takeSeats() {
	System.out.println("The audience is taking their seats.");
	}
	@Before("performance()")
	public void turnOffCellPhones() {
	System.out.println("turnning off cell phones");
	}
	@AfterReturning("performance()")
	public void applaud() {
	System.out.println("CLAP CLAP CLAP CLAP CLAP");
	}
	@AfterThrowing("performance()")
	public void demandRefund() {
	System.out.println("Boo! We want our money back!");		
    }
	
//	@After("performance()")
//	public void eating(){
//		System.out.println("*****************************************");
//	}
//	
/*
 * applying all advices for performAction() method 	
 */
	/*@Pointcut("execution(* *.performAction(..))")
	public void performanceAction(){ }
	@Before("performanceAction()")
	public void huntingByRam(){
		System.out.println("Hunting completed : ");
	}
	@After("performanceAction()")
	public void eatingByRam(){
		System.out.println("*****Eaten By Ram : *******");
	}
	@AfterReturning("performanceAction()")
	public void delicious(){
		System.out.println("*********Delicious : **************");
	}*/
	
	@Pointcut("execution(* *.performAction(..))")
		public void permanceAction(){}
	@Around("permanceAction()")
		public void show(){
		System.out.println("You have to show....................");
		System.out.println("End.");
	}
}